package model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

@Entity
@Table(name = "NguoiDung")
public class NguoiDung {
	private int id_NguoiDung;
	private String tenNguoiDung;
	private String email;
	private String passWord;
	private boolean gioiTinh;
	private String diaChi;
	private Date ngaySinh;
	private String soDienThoai;
	private CapDo capDo;

	public NguoiDung(int id_NguoiDung, String tenNguoiDung, String email,
			String passWord, boolean gioiTinh, String diaChi,
			String soDienThoai, CapDo capDo) {
		super();
		this.id_NguoiDung = id_NguoiDung;
		this.tenNguoiDung = tenNguoiDung;
		this.email = email;
		this.passWord = passWord;
		this.gioiTinh = gioiTinh;
		this.diaChi = diaChi;
		this.soDienThoai = soDienThoai;
		this.capDo = capDo;
	}
	public NguoiDung(String tenNguoiDung, String email, String passWord,
			boolean gioiTinh, String diaChi, String soDienThoai, Date ngaySinh,
			CapDo capDo) {
		super();
		this.tenNguoiDung = tenNguoiDung;
		this.email = email;
		this.passWord = passWord;
		this.gioiTinh = gioiTinh;
		this.diaChi = diaChi;
		this.soDienThoai = soDienThoai;
		this.ngaySinh = ngaySinh;
		this.capDo = capDo;
	}

	public NguoiDung(String email, String passWord) {
		super();
		this.email = email;
		this.passWord = passWord;
	}

	public NguoiDung() {

	}

	@Id
	@GeneratedValue(generator = "NguoiDung_ID_Gen", strategy = GenerationType.IDENTITY)
	@SequenceGenerator(name = "NguoiDung_ID_Gen", sequenceName = "NguoiDung_SEQ_ID")
	@Column(name = "ID_NguoiDung", unique = true, nullable = false)
	public int getId_NguoiDung() {
		return id_NguoiDung;
	}

	public void setId_NguoiDung(int id_NguoiDung) {
		this.id_NguoiDung = id_NguoiDung;
	}

	@Column(name = "TenNguoiDung", nullable = false)
	public String getTenNguoiDung() {
		return tenNguoiDung;
	}

	public void setTenNguoiDung(String tenNguoiDung) {
		this.tenNguoiDung = tenNguoiDung;
	}

	@Column(name = "Email", nullable = false)
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "PassWord", nullable = false)
	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	@Column(name = "GioiTinh")
	@Type(type = "yes_no")
	public boolean isGioiTinh() {
		return gioiTinh;
	}

	public void setGioiTinh(boolean gioiTinh) {
		this.gioiTinh = gioiTinh;
	}

	@Column(name = "DiaChi", nullable = false)
	public String getDiaChi() {
		return diaChi;
	}

	public void setDiaChi(String diaChi) {
		this.diaChi = diaChi;
	}

	@Column(name = "SoDienThoai", nullable = false)
	public String getSoDienThoai() {
		return soDienThoai;
	}

	public void setSoDienThoai(String soDienThoai) {
		this.soDienThoai = soDienThoai;
	}

	@ManyToOne
	@JoinColumn(name = "ID_CapDo")
	public CapDo getCapDo() {
		return capDo;
	}

	public void setCapDo(CapDo capDo) {
		this.capDo = capDo;
	}

	@Column(name = "NgaySinh", nullable = false)
	public Date getNgaySinh() {
		return ngaySinh;
	}

	public void setNgaySinh(Date ngaySinh) {
		this.ngaySinh = ngaySinh;
	}

}
